#pragma once
#ifndef xVertex_h__
#define xVertex_h__

#include "../../../dxhead/dxegheader.h"
#include "../../../xlib/xlib.h"
#include "xRes.h"
#include "./xDxType.h"
namespace Sky
{
	class xVertex : public xDeviceRes<LPDIRECT3DVERTEXBUFFER9>
	{
	private:
		static TUint ms_Usage;
		static TUint ms_Fvf;
		static D3DPOOL ms_Pool;
	public:
		static TVoid StaticInit(TUint fvf,TUint D3DUSAGE_ = D3DUSAGE_DYNAMIC,D3DPOOL D3DPOOL_ = D3DPOOL_DEFAULT)
		{
			ms_Usage = D3DUSAGE_;
			ms_Fvf = fvf;
			ms_Pool = D3DPOOL_;
		}
	public:
		xVertex();
		~xVertex();
	protected:
		virtual TResult onCreate(xDxApp* app);
		virtual TResult onDelete(xDxApp* app);
		//xRes
		virtual TResult onCreate(xDevice* device);
		virtual TResult onReset(xDevice* device) ;
		virtual TResult onLost(xDevice* device);
		virtual TResult onDelete(xDevice* device);
	private:
		TVoid Initialise();
		TVoid Finalise();
	public:
		xVertex& setLenth(TUint length){m_Length = length;return *this;}
		xVertex& setUsage(TUint D3DUSAGE_ = D3DUSAGE_DYNAMIC){m_Usage = D3DUSAGE_;return *this;}
		xVertex& setFVF(TUint D3DFVF_){m_Fvf = D3DFVF_;return *this;}
		xVertex& setPool(D3DPOOL D3DPOOL_=D3DPOOL_DEFAULT){m_Pool = D3DPOOL_;return *this;}
	private:
		TUint m_Length;
		TUint m_Usage;
		TUint m_Fvf;
		D3DPOOL m_Pool;
	};
}
#endif // xVertex_h__